DIR=$(shell pwd)
GJS=$(DIR)/gcc/gjs1
CC=gcc
.PHONY: all
GROWL=DYLD_LIBRARY_PATH= growlnotify
NOTIFY=&& $(GROWL) -m "Build success" --image ./img/ok.png || $(GROWL) -m "Build failed" --image ./img/error.png
all: gjs test
gjs:
	$(MAKE) -f Makefile $(NOTIFY)
	$(GJS) ./test.js -o ./test.s
	$(CC) ./test.s -L$(HOME)/lib -l gjs -o ./out
	./out

.PHONY: force
force: clean
	-rm $(GJS) gcc/js-*.o
	$(MAKE) -f ./test.mk

valgrind:
	valgrind $(GJS) ./test-js/fibo.js

.PHONY: clean
clean:
	-$(RM) -rf ./out ./*.s
	$(MAKE) -C test-js clean

.PHONY: test
test:
	$(MAKE) -C test-js BINDIR=$(DIR)

